
package com.tito.t_kulfonkup.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.tito.t_kulfonkup.R;

public class Play extends Fragment {

    // Simple class for maintaining results' round view
    /**
     * should this one be like ?? After hitting a play button user is directed
     * to a fragment in which upper half of the screen is occupied by the
     * current game fragment. Lower half of the screen is occupied by the round
     * table as well as by the round results Should we then have three classes??
     * : CurrentGame + RoundTable + RoundResult
     */

    @Override
    public View onCreateView(LayoutInflater inflater,
            ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.play_layout, container, false);

        Fragment currentGame = new CurrentGame();
        FragmentTransaction t1 = getChildFragmentManager().beginTransaction();
        t1.add(R.id.current_game, currentGame).commit();

        Fragment roundTable = new RoundTable();
        FragmentTransaction t2 = getChildFragmentManager().beginTransaction();
        t2.add(R.id.round_table, roundTable).commit();

        Button button = (Button) view.findViewById(R.id.button_submit);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Log.d("Kulfon", "btn clicked!");
            }
        });

        return view;

    }

}
